﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using FreeSql.DataAnnotations;
using Newtonsoft.Json;

namespace Bzzb.Model
{
    [Table(Name = "user")]
    public class User
    {
        [Column(IsIdentity = true, IsPrimary = true, Name = "id")]
        [JsonProperty("id")]
        public long Id { get; set; }

        [Column(Name = "username")]
        [JsonProperty("username")]
        public string Username { get; set; }

        [Column(Name = "password")]
        [JsonProperty("password")]
        public string Password { get; set; }

        [Column(Name = "realname")]
        [JsonProperty("realname")]
        public string Realname { get; set; }

        [Column(Name = "mobile")]
        [Description("手机号码")]
        [JsonProperty("mobile")]
        public string Mobile { get; set; }

        [Column(Name = "joindate", DbType = "datetime(0) NOT NULL")]
        [Description("入职日期")]
        [JsonProperty("joindate")]
        public string Joindate { get; set; }

        [Column(Name = "sex")]
        [JsonProperty("sex")]
        public string Sex { get; set; }

        [Column(Name = "avater")]
        [JsonProperty("avater")]
        [Description("头像")]
        public string Avater { get; set; }

        [Column(Name = "dpids", IsIgnore = true)]
        [Description("逗号分隔的部门ID")]
        [JsonProperty("dpids"), Newtonsoft.Json.JsonIgnore]
        public long[] Dpids { get; set; }

        [Column(Name = "rids", IsIgnore = true)]
        [Description("逗号分隔的角色ID")]
        [JsonProperty("rids"), Newtonsoft.Json.JsonIgnore]
        public string Rids { get; set; }

        //[Column(Name = "pmids")]
        //[Description("逗号分隔的权限ID")]
        //[JsonProperty("pmids")]
        //public string Pmids { get; set; }

        [Column(Name = "created", ServerTime = DateTimeKind.Local, CanUpdate = false, DbType = "datetime(0) NOT NULL")]
        [JsonProperty("created")]
        public DateTime CreateTime { get; set; }

        [Column(Name= "updated", ServerTime = DateTimeKind.Local, DbType = "datetime(0) NOT NULL")]
        [JsonProperty("updated")]
        public DateTime UpdateTime { get; set; }
    }
}
